package com.ruoyi.business.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 存储设备类型信息的，支持树状结构对象 equipment_types
 * 
 * @author ldkj
 * @date 2025-03-12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("equipment_types")
public class EquipmentTypes implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 设备类型ID，自增主键 */
    @TableId(value = "equipment_type_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long equipmentTypeId;

    /** 父级设备类型ID，NULL表示顶级类型 */
    @TableField(value = "parent_equipment_type_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentEquipmentTypeId;

    /** 父级设备类型名称，用于Excel导入导出 */
    @Excel(name = "父级设备类型名称")
    @TableField(exist = false)
    private String parentEquipmentTypeName;

    /** 设备类型名称，不能为空 */
    @Excel(name = "设备类型名称")
    @TableField(value = "equipment_type_name")
    private String equipmentTypeName;

    /** 设备名称编码，用于标识设备类型 */
    @Excel(name = "设备名称编码")
    @TableField(value = "equipment_type_code")
    private String equipmentTypeCode;

    /** 设备类型描述 */
    @Excel(name = "设备类型描述")
    @TableField(value = "description")
    private String description;

    /** 设备制造商 */
    @Excel(name = "设备制造商")
    @TableField(value = "manufacturer")
    private String manufacturer;

    /** 设备安装日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "设备安装日期", width = 30, dateFormat = "yyyy-MM-dd")
    @TableField(value = "installation_date")
    private Date installationDate;

    /** 设备维护状态 */
    @Excel(name = "设备维护状态")
    @TableField(value = "maintenance_status")
    private String maintenanceStatus;

    /** 质保期（月） */
    @Excel(name = "质保期（月）", cellType = Excel.ColumnType.NUMERIC)
    @TableField(value = "warranty_period")
    private Long warrantyPeriod;

    /** 设备位置 */
    @Excel(name = "设备位置")
    @TableField(value = "location")
    private String location;

    /** 运行状态 1:运行 2:空闲 3:维修 */
    @Excel(name = "运行状态")
    @TableField(value = "operation_status")
    private String operationStatus;

    /** 使用时长 */
    @Excel(name = "使用时长", cellType = Excel.ColumnType.NUMERIC, scale = 2)
    @TableField(value = "usage_duration")
    private BigDecimal usageDuration;

    /** 使用次数 */
    @Excel(name = "使用次数", cellType = Excel.ColumnType.NUMERIC)
    @TableField(value = "usage_count")
    private Long usageCount;

    /** 预计使用时长 */
    @Excel(name = "预计使用时长", cellType = Excel.ColumnType.NUMERIC, scale = 2)
    @TableField(value = "exp_usage_dur")
    private BigDecimal expUsageDur;

    /** 预计使用次数 */
    @Excel(name = "预计使用次数", cellType = Excel.ColumnType.NUMERIC)
    @TableField(value = "exp_usage_count")
    private Long expUsageCount;

    /** 磨损比例分析 */
    @Excel(name = "磨损比例分析", cellType = Excel.ColumnType.NUMERIC, scale = 4)
    @TableField(value = "wear_ratio_analysis")
    private BigDecimal wearRatioAnalysis;

    /** 剩余使用次数 */
    @Excel(name = "剩余使用次数", cellType = Excel.ColumnType.NUMERIC)
    @TableField(value = "rem_usage_count")
    private Long remUsageCount;

    /** 剩余使用时长 */
    @Excel(name = "剩余使用时长", cellType = Excel.ColumnType.NUMERIC, scale = 2)
    @TableField(value = "rem_usage_dur")
    private BigDecimal remUsageDur;

    /** 子设备类型列表，用于树状结构显示 */
    @TableField(exist = false)
    private java.util.List<EquipmentTypes> children = new java.util.ArrayList<>();

    /** 创建者 */
    @TableField(exist = false)
    private String createBy;

    /** 更新者 */
    @TableField(exist = false)
    private String updateBy;

    /** 创建时间 */
    @TableField(exist = false)
    private Date createTime;

    /** 更新时间 */
    @TableField(exist = false)
    private Date updateTime;

    public java.util.List<EquipmentTypes> getChildren() {
        return children;
    }

    public void setChildren(java.util.List<EquipmentTypes> children) {
        this.children = children;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }


}
